<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-3.3.1.min.js"></script>
</head>
<body>

<h2>异步加载省份</h2>
<!--
    需求: 当页面加载成功之后, 异步获取省份信息, 显示到页面下拉框中
-->

省份:
<select id="province">
    <option>--请选择省份--</option>
</select>


<script>
    $(function () {
        $.post(
            "provinceServlet",
            {},
            function (data) {
                $(data).each(function () {
                    $("#province").append("<option value='"+this.id+"'>"+this.name+"</option>>")
                })
            },
            "json"
        )
    })

</script>
</body>
</html>